package com.zzh.partnersys.controller;


import com.zzh.partnersys.common.exception.BusinessException;
import com.zzh.partnersys.common.exception.ResultCodeEnum;
import com.zzh.partnersys.common.exception.ResultUtils;
import com.zzh.partnersys.entity.vo.FriendMessageVO;
import com.zzh.partnersys.service.FriendMessageService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 队伍消息�?前端控制�?
 * </p>
 *
 * @author zzh
 * @since 2024-08-12
 */
@RestController
@RequestMapping("/friendMessage")
public class FriendMessageController {
    @Autowired
    private FriendMessageService friendMessageService;

    @GetMapping("/getMessage/byFriendKey")
    public ResultUtils friendMessageByFriendKey(String friendKey){
        if (StringUtils.isBlank(friendKey)){
            throw new BusinessException(ResultCodeEnum.PARAMS_ERROR);
        }
        List<FriendMessageVO> messageList =  friendMessageService.selectMessageByFriendKey(friendKey);
        return ResultUtils.ok(messageList);
    }
}

